###
# 
# (C) Copyright 2019 - ShenYongchen.
#
#
###############################################################################
# Document
# 
find_package(Doxygen)

# 
# if found doxygen
# 
if(DOXYGEN_FOUND)
  # 
  # DOXYGEN_LANGUAGE
  # 
  set(DOXYGEN_LANGUAGE "English" CACHE STRING "Language used by doxygen")
  mark_as_advanced(DOXYGEN_LANGUAGE)

  # 
  # you could also set the version or other defines, see Doxygen.in
  # 
  # [1] Project related configuration options
  # 
  # PROJECT_NAME           = @SFX_DOXYGEN_PROJECT_NAME@
  # PROJECT_NUMBER         = @SFX_DOXYGEN_PROJECT_VERSION@
  #
  set(SFX_DOXYGEN_PROJECT_NAME "sfxLibrary")
  set(SFX_DOXYGEN_PROJECT_VERSION "1.0.0")

  # 
  # [4] Configuration options related to the source input files
  # 
  # INPUT                 = @SFX_DOXYGEN_INPUT_LIST@
  # IMAGE_PATH            = @SFX_DOXYGEN_IMAGE_PATH@
  # FILE_PATTERNS         = @SFX_DOXYGEN_FILE_PATTERNS@
  # 
  # SFX_DOXYGEN_INPUT_LIST
  set(_document_source_dir_
    "${CMAKE_CURRENT_LIST_DIR}"
    "${CMAKE_SOURCE_DIR}/Source"
  )
  string(REPLACE ";" " " SFX_DOXYGEN_INPUT_LIST "${_document_source_dir_}")
  # message(STATUS "SFX_DOXYGEN_INPUT_LIST = " ${SFX_DOXYGEN_INPUT_LIST})

  # SFX_DOXYGEN_IMAGE_PATH
  set(SFX_DOXYGEN_IMAGE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/images")
  
  # SFX_DOXYGEN_FILE_PATTERNS
  set(SFX_DOXYGEN_FILE_PATTERNS "*.c *.cpp *.cxx *.h *.hxx")

  # 
  # configure_file
  # 
  configure_file(Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)

  # 
  # add_custom_target
  # 
  set(HTML_TARGET "helpDocument" )
  add_custom_target(${HTML_TARGET} ALL
    ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)

  # 
  # install
  # 
  # install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" DESTINATION "${CMAKE_CURRENT_LIST_DIR}")
  # message(STATUS "CMAKE_CURRENT_LIST_DIR = " ${CMAKE_CURRENT_LIST_DIR})
  # 
  else()
  # 
  message(STATUS "doxygen binary couldn't be found - waring...")
  # 
endif()

# 
#}}@@@
# 
